<?php

namespace App\Http\Requests\Frontend\V10\BankCard;

use App\Models\UserChangeBankCardRecord;
use App\Rules\MobileCheck;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ChangeCardRequest extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'card_id' => 'required',
            'purpose' => [
                'bail',
                'required',
                Rule::in([UserChangeBankCardRecord::PURPOSE_LOAN,UserChangeBankCardRecord::PURPOSE_REPAY]),
            ],
            'summary_id' => ['bail'],
        ];
    }

    public function messages()
    {
        return [
            'card_id.required' => '缺少银行卡Id',
            'purpose.required' => '缺少换卡目的',
            'purpose.in' => '换卡目的格式不正确',
        ];
    }
}
